<style type="text/css">
	td:hover{background: violet;}
</style>
<?php
include '../config/DBConnect.php';

$tang=$_GET['tang'];
$get_room="select * from phong where tang =".$tang;
//var_dump($get_room);
$query=mysql_query($get_room);
$list_room=array();
if (mysql_num_rows($query) > 0){

	while($rows=mysql_fetch_array($query)){
		$temp=array();
		$temp['maphong']=$rows['maphong'];
		$temp['sosinhvien']=$rows['sosinhvien'];
		$temp['loaiphong']=$rows['loaiphong'];
		array_push($list_room,$temp);
	}
}else{
	echo "KhÔng có phòng nào được tìm thấy !!";
}
?>
<fieldset>
	<legend>Danh sách phòng tầng <?php echo "$tang"; ?></legend>
	<table border='0' style='margin-top:30px; text-align:center;'>
		<tbody>
			<tr>
				<?php   
				$a = "heeee";      
				$count=0;
				foreach($list_room as $value){
					$count++;
					if($count==0){
						echo "<tr>";					
					}	
					if($value['sosinhvien']==8){	
						?>

						<td height='50' width='50' style='background:red;	'>
							<div class='room' style='align:center;' onclick="showId('<?php echo $value['maphong'] ?>')"><span><?php echo $value['maphong']; ?></span><br/><span><b><?php echo $value["sosinhvien"]; ?>/8<br/>
								<?php echo $value['loaiphong']; ?>
							</b></span></div></td>
							<?php

						}else{
							?>

							<td height='50' width='50' style='background:green;'>
								<div class='room' style='align:center;' onclick="showId('<?php echo $value['maphong'] ?>')"><a><span><?php echo $value['maphong']; ?></span></a><br/><span><b><?php echo $value["sosinhvien"]; ?>/8<br/>
									<?php echo $value['loaiphong']; ?>
								</b></span></div></td>
								<?php
							}
							if($count==5){
								$count=0;
								echo "</tr>";
							}
						}
						?>
					</tr>
				</tbody>
			</table>
		</fieldset>

